package com.xinhe.web.reposity;

import com.xinhe.web.entity.SellerShop;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Set;

public interface SellerShopRepository  extends JpaRepository<SellerShop, Long> {
    @Query(value = "select * from tb_seller_shop where removed = 0 and f_user_id = ?1 and status <> ?2 ", nativeQuery = true)
    SellerShop findByUserIdAndNotStatus(Long userId, String failure);
    @Query(value = "select * from tb_seller_shop where removed = 0 and name = ?1 and status='SUCCESS' ", nativeQuery = true)
    SellerShop findByName(String name);
    @Query(value = "select * from tb_seller_shop where removed = 0 and f_user_id = ?1 and status ='SUCCESS' ", nativeQuery = true)
    SellerShop findByUserId(Long sellerUserId);
    @Query(value = "select * from tb_seller_shop where removed = 0 and f_user_id in ?1 ", nativeQuery = true)
    List<SellerShop> findByUserIds(Set<Long> sellerUserIds);
}
